<template>
    <div>
        <ve-line :data="chartData"></ve-line>
    </div>
</template>

<script>
    export default {
        name: "EpidemicTend",
        data: function () {
            return {
                chartData: {
                    columns: ['日期', '累计确诊', '现有疑似', '累计死亡'],
                    rows:[],
                },


            }
        },
        created(){
            console.log(this.$store);
            setTimeout(() =>{
                this.getRowsArr();
            },2000);

        },

        computed: {
            countData() {
                return this.$store.state.countData;
            },
            historyArr() {
                return this.countData.history;
            },
        },
        watch: {
        },
        methods:{
            getRowsArr(){
                let rowArr = []
                let hisArr = this.$store.state.countData.history;
                hisArr.forEach( item =>{
                    console.log("1");
                    let rowObj = { '日期': item.date, '累计确诊': item.confirmedNum, '现有疑似': item.suspectedNum, '累计死亡': item.deathsNum };
                    rowArr.unshift(rowObj)
                })
                this.chartData.rows = rowArr;
               // return rowArr;
            }
        }
    }
</script>

<style scoped>

</style>